package com.mak001.lite.multiSkill.GUI.Tabs;

import java.awt.Dimension;
import java.awt.Insets;
import java.awt.Rectangle;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class CookerTab extends JPanel {
	private static final long serialVersionUID = 1L;

	private JTextField textField8;
	private JComboBox foodDropDown;
	private JTextField textField10;
	private JComboBox cookerLogDropDown;

	String[] raw = { "crayfish", "shrimp", "sardine", "herring", "anchovy",
			"karambwan", "mackerel", "trout", "cod", "pike", "slimey eel",
			"salmon", "tuna", "cave eel", "rainbow fish", "lobster", "bass",
			"swordfish", "monkfish", "shark", "sea turtle", "manta ray",
			"cavefish", "rocktail", "bear meat", "rat meat", "yak meat",
			"pawya meat", "ugthanki meat", "chicken" };
	String[] logs = { "normal", "achey", "oak", "wilow", "teak", "maple",
			"mahogany", "arctic pine", "eucalyptus", "yew", "magic" };

	public CookerTab() {
		textField8 = new JTextField();
		foodDropDown = new JComboBox();
		textField10 = new JTextField();
		cookerLogDropDown = new JComboBox();

		this.setLayout(null);

		// ---- textField8 ----
		textField8.setText("Food to Cook");
		textField8.setEditable(false);
		textField8.setHorizontalAlignment(SwingConstants.CENTER);
		this.add(textField8);
		textField8.setBounds(10, 25, 150, textField8.getPreferredSize().height);

		// ---- foodDropDown ----
		foodDropDown.setModel(new DefaultComboBoxModel(raw));
		this.add(foodDropDown);
		foodDropDown.setBounds(10, 50, 150,
				foodDropDown.getPreferredSize().height);

		// ---- textField10 ----
		textField10.setText("Logs to Burn");
		textField10.setEditable(false);
		textField10.setHorizontalAlignment(SwingConstants.CENTER);
		this.add(textField10);
		textField10.setBounds(195, 25, 140,
				textField10.getPreferredSize().height);

		// ---- cookerLogDropDown ----
		cookerLogDropDown.setModel(new DefaultComboBoxModel(logs));
		this.add(cookerLogDropDown);
		cookerLogDropDown.setBounds(195, 50, 140, cookerLogDropDown
				.getPreferredSize().height);

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for (int i = 0; i < this.getComponentCount(); i++) {
				Rectangle bounds = this.getComponent(i).getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width,
						preferredSize.width);
				preferredSize.height = Math.max(bounds.y + bounds.height,
						preferredSize.height);
			}
			Insets insets = this.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			this.setMinimumSize(preferredSize);
			this.setPreferredSize(preferredSize);
		}
	}

	public String getFoodName() {
		return foodDropDown.getSelectedItem().toString();
	}

	public int getRaw() {
		String s = foodDropDown.getSelectedItem().toString();
		if (s.contains("crayfish")) {
			return 13435;
		} else if (s.contains("shrimp")) {
			return 317;
		} else if (s.contains("sardine")) {
			return 327;
		} else if (s.contains("herring")) {
			return 345;
		} else if (s.contains("anchovy")) {
			return 321;
		} else if (s.contains("karambwan")) {
			return 3142;
		} else if (s.contains("mackerel")) {
			return 353;
		} else if (s.contains("trout")) {
			return 335;
		} else if (s.contains("cod")) {
			return 341;
		} else if (s.contains("pike")) {
			return 349;
		} else if (s.contains("slimey eel")) {
			return 3379;
		} else if (s.contains("salmon")) {
			return 331;
		} else if (s.contains("tuna")) {
			return 359;
		} else if (s.contains("cave eel")) {
			return 5001;
		} else if (s.contains("rainbow fish")) {
			return 10138;
		} else if (s.contains("lobster")) {
			return 377;
		} else if (s.contains("bass")) {
			return 363;
		} else if (s.contains("swordfish")) {
			return 371;
		} else if (s.contains("monkfish")) {
			return 7944;
		} else if (s.contains("shark")) {
			return 383;
		} else if (s.contains("sea turtle")) {
			return 395;
		} else if (s.contains("manta ray")) {
			return 389;
		} else if (s.contains("cavefish")) {
			return 15264;
		} else if (s.contains("rocktail")) {
			return 15270;
		} else if (s.contains("meat")) {
			if (s.contains("bear")) {
				return 2136;
			} else if (s.contains("rat")) {
				return 2134;
			} else if (s.contains("ugthanki")) {
				return 1859;
			} else if (s.contains("pawya")) {
				return 12535;
			} else { // yak
				return 10816;
			}
		} else { // chicken
			return 2138;
		}
	}

	public int getLogs() {
		String s = cookerLogDropDown.getSelectedItem().toString();
		if (s.contains("normal")) {
			return 1511;
		} else if (s.contains("achey")) {
			return 2862;
		} else if (s.contains("oak")) {
			return 1521;
		} else if (s.contains("wilow")) {
			return 1519;
		} else if (s.contains("teak")) {
			return 6333;
		} else if (s.contains("maple")) {
			return 1517;
		} else if (s.contains("mahogany")) {
			return 6332;
		} else if (s.contains("arctic pine")) {
			return 10810;
		} else if (s.contains("eucalyptus")) {
			return 12581;
		} else if (s.contains("yew")) {
			return 1515;
		} else {// magic
			return 1513;
		}
	}

}
